package com.jackstraw.jack_base.datasource.mybatis.base.service;

import com.jackstraw.jack_base.datasource.database.parten.base.service.CrudService;
import com.jackstraw.jack_base.datasource.mybatis.base.dao.MyBatisDao;
import com.jackstraw.jack_base.datasource.mybatis.base.entity.po.MyBatisPo;
import com.jackstraw.jack_base.datasource.mybatis.base.entity.po.PoExample;
import com.jackstraw.jack_base.util.function.ReflectionUtil;

/**
 * Mybatis默认service
 *
 * @param <DAO> 持久层
 * @param <PO>  数据库实体类
 * @param <BO>  业务操作类
 * @param <ID>  主键（基本数据类型）
 * @param <PE>  PoExample
 */
public interface MyBatisService<DAO extends MyBatisDao<PO, ID, PE>,
        PO extends ID, BO extends PO, ID extends MyBatisPo<PO>, PE extends PoExample>
        extends CrudService<DAO, PO, BO, ID> {



    /**
     * 获取PE Class
     *
     * @return
     */
    Class<PE> getPeClass();

    /**
     * 创建PoExample对象
     *
     * @return
     */
    default PE newPE() {
        return (PE) ReflectionUtil.newInstance(this.getClass(), 4);
    }



}
